Skip to content

Conversation

@kio-watanabe
Copy link
Contributor

@kio-watanabe kio-watanabe commented Jan 31, 2025

Summary:

  • The system has been modified to support COBOL source code written in UTF-8, including multibyte characters.
  • In licobj, all multi-byte characters are handled as SJIS.
  • Literals, variable names, and label names written in UTF-8 multi-byte characters are written as UTF-8 in the generated Java files.
  • In Opensource COBOL 4J, some UTF-8 handling code inherited from Opensource COBOL remained. This code was partially reused or modified.
  • A new cobol-utf8 test was added, and all the tests are passing.

Note:

  • Although modifications have been made to handle a wide range of Japanese characters, there's a possibility of unexpected errors if specialized kanji are used.

Details:
For more details, please check the cobol-utf8 test

  • VALUE clause
    example:

    01 N-str PIC N(n) VALUE "日本語文字列".
    01 X-str PIC X(n) VALUE "日本語文字列".
    
  • MOVE statement
    example:

    MOVE "日本語文字列" TO N-str.
    MOVE "日本語文字列" TO X-str.
    
    01 F0 PIC XXXXXX/XXXXXXBXXXXXX0.
    MOVE "日本中国文字" TO F0.
    
  • DISPLAY statement
    example:

    DISPLAY "いろは".
    DISPLAY N"いろは".
    DISPLAY NC"いろは".
    DISPLAY ND"いろは".
    DISPLAY NX"E38184E3828DE381AF".
    
  • Reference modification
    example:

     01  X項目 PIC N(5) VALUE "ABCDE".
     DISPLAY X項目(3:2).
     DISPLAY X項目(3:).
    
  • PROGRAM-ID.
    example:

    • PROGRAM-ID. いろは.
      • java file name : _E38184_E3828D_E381AF.java
      • class name: _E38184_E3828D_E381AF
  • file handler name and file path
    example:
    SELECT 日本語ファイル ASSIGN TO "./日本語ファイル"

  • label name
    example:

     PROCEDURE        DIVISION.
         見出し.
     	STOP RUN.
    
  • field name
    example:

     01  I項目         PIC 9 VALUE 2.
    
  • STRING statement
    example:

     01 F0 PIC N(2)  VALUE "私の".
     01 F1 PIC N(3)  VALUE "名前は".
     01 F2 PIC N(5) VALUE "ありません".
     01 FF PIC N(10).
     STRING F0 F1 F2 DELIMITED BY SIZE INTO FF.
    
    01 F0 PIC N(2)  VALUE "私の".
    01 F1 PIC N(4)  VALUE "名前△は".
    01 F2 PIC N(6) VALUE "△ありません".
    01 FF PIC N(4).
    STRING F0 F1 F2 DELIMITED BY "△" INTO FF.
    
    01 F0 PIC N(2)  VALUE "私の".
    01 F1 PIC N(3)  VALUE "名前は".
    01 F2 PIC N(5)  VALUE "ありません".
    01 FF PIC N(10) VALUE "言えません◎○△■※".
    01 FP PIC 99    VALUE 16.
     STRING F0 F1 F2 DELIMITED BY SIZE INTO FF WITH POINTER FP.
    
  • INSPECT statement
    example:

    01 F0 PIC X(30)  VALUE "1234512345".
    INSPECT F0 REPLACING ALL "5" BY "0".
    INSPECT F0 REPLACING ALL "5" BY ZERO.
    INSPECT F0 TALLYING CN FOR ALL "45".
    
  • FUNCTION NATIONAL
    example:

    MOVE "ABC123" TO I-STR.
    MOVE FUNCTION NATIONAL(I-STR) TO O-STR.
    

yutaro-sakamoto and others added 30 commits December 10, 2024 05:52
@yutaro-sakamoto yutaro-sakamoto merged commit 99d1204 into opensourcecobol:develop Jan 31, 2025
139 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants